home *** CD-ROM | disk | FTP | other *** search
/ Aminet 37 / Aminet 37 (2000)(Schatztruhe)[!][Jun 2000].iso / Aminet / dev / lang / sofa.lha / sofa / smalleiffel / sys / runtime / gc_lib.h < prev    next >
C/C++ Source or Header  |  2000-03-25  |  3KB  |  129 lines

  1. /*
  2. -- This file is  free  software, which  comes  along  with  SmallEiffel. This
  3. -- software  is  distributed  in the hope that it will be useful, but WITHOUT 
  4. -- ANY  WARRANTY;  without  even  the  implied warranty of MERCHANTABILITY or
  5. -- FITNESS  FOR A PARTICULAR PURPOSE. You can modify it as you want, provided
  6. -- this header is kept unaltered, and a notification of the changes is added.
  7. -- You  are  allowed  to  redistribute  it and sell it, alone or as a part of 
  8. -- another product.
  9. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  10. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr 
  11. --                       http://SmallEiffel.loria.fr
  12. --
  13. */
  14. /* 
  15.    This file (SmallEiffel/sys/runtime/gc_lib.h) is automatically included 
  16.    when the Garbage Collector is used (default, unless option -no_gc has 
  17.    been selected).
  18. */
  19. #define SE_GC_LIB 1
  20.  
  21. #define RSOH_UNMARKED 15253     
  22. #define RSOH_MARKED 0
  23. #define RSOH_FREE 1
  24.  
  25.  
  26. #define FSOH_UNMARKED 1
  27. #define FSOH_MARKED 0
  28.  
  29. /* To codify the state and the type of some Memory Chunk, we are 
  30.    using the following definitions :
  31. */
  32. #define FSO_FREE_CHUNK  (-2)
  33. #define RSO_FREE_CHUNK  (-1)
  34. #define RSO_USED_CHUNK  ( 0)
  35. #define FSO_STORE_CHUNK ( 1)
  36. #define FSO_USED_CHUNK  ( 2)
  37. #define FREE_CHUNK(x) ((x)<0)
  38.  
  39. /* Minimum size for a store area in a ReSizable Objects Chunk :
  40.  */
  41. #define RSOC_MIN_STORE 512
  42.  
  43. /* The default channel used to print -gc_info flag information :
  44. */
  45. #define SE_GCINFO SE_ERR
  46.  
  47. typedef struct s_mch mch; /* Memory Chunk Header. */
  48. typedef struct s_fsoc fsoc; /* Fixed Size Objects Chunk. */
  49. typedef union u_rsoh rsoh; /* ReSizable Object Header. */
  50. typedef struct s_fll_rsoh fll_rsoh; 
  51. typedef struct s_rsoc rsoc; /* ReSizable Objects Chunk. */
  52. typedef struct s_na_env na_env; /* Native Array ENVironment. */
  53.  
  54.  
  55. struct s_mch{ 
  56.   int size; /* In number of bytes (actual argument of malloc).*/
  57.   int state_type; /* One value in : RSO_USED_CHUNK, 
  58.                      FREE_CHUNK, FSO_STORE_CHUNK, FSO_USED_CHUNK */
  59.   void(*amfp)(mch*,void*); /* Align Mark Function Pointer. */
  60.   void(*swfp)(mch*); /* SWeep Function Pointer. */
  61. };
  62.  
  63. struct s_fsoc{
  64.   mch header;
  65.   fsoc* next;
  66.   int count_minus_one;
  67.   double first_object;
  68. };
  69.  
  70. typedef struct _rso_header rso_header;
  71.  
  72. struct _rso_header{
  73.     int size;
  74.     int magic_flag;     /* RSOH_MARKED when used,
  75.                RSOH_FREE when free,
  76.                else RSOH_UNMARKED */
  77. };
  78.  
  79. union u_rsoh{
  80.   rso_header header;             
  81.   double padding; 
  82.   };
  83.  
  84. struct s_fll_rsoh {
  85.   rso_header rsoh_field;
  86.   fll_rsoh* nextflol;
  87. };
  88.  
  89. struct s_rsoc{
  90.   mch header;
  91.   rsoc* next;
  92.   fll_rsoh*free_list_of_large;
  93.   na_env*nae;
  94.   rsoh first_header;
  95. };
  96.  
  97. struct s_na_env{
  98.   int store_left;
  99.   rsoh* store;
  100.   rsoc*store_chunk;
  101.   rsoc*chunk_list;
  102.   void (*gc_mark)(T0*);
  103. };
  104.  
  105. extern void**stack_bottom;
  106. extern mch**gcmt;
  107. extern int gcmt_max;
  108. extern int gcmt_used;
  109. extern fsoc*fsocfl;
  110. extern rsoc*rsocfl;
  111. extern int gc_is_off;
  112. extern unsigned int fsoc_count;
  113. extern unsigned int rsoc_count;
  114. extern void*gcmt_tail_addr;
  115.  
  116. int na_rounded_size(int s);
  117. void gc_sweep(void);
  118. void gc_mark(void*p);
  119. int gc_stack_size(void);
  120. int garbage_delayed(void);
  121. void gc_update_ceils(void);
  122. fsoc*new_fsoc(void);
  123. char*new_na(na_env*nae,int size);
  124. void gcna_align_mark(rsoc*c,void*o);
  125. int fsocfl_count(void);
  126. int rsocfl_count(void);
  127. void gc_dispose_before_exit(void);
  128. void rsocfl_info(void);
  129.